import { apiGet, apiPost } from './client'

export interface ScoreTotal {
  id?: number
  studentId?: number
  offeringId?: number
  totalScore?: number
  gpa?: number
  publishedFlag?: number
  calcVersion?: number
  calculatedAt?: string
}

export async function publishScores(offeringId: number) {
  // 后端使用RequestParam传递offeringId
  return apiPost<string>('/api/grades/scores/publish', undefined, { offeringId })
}

export async function listScoreTotalsByStudent(studentId: number, termId: number) {
  return apiGet<ScoreTotal[]>(`/api/grades/scores/student/${studentId}`, { termId })
}